

/*
	Base Business Objects.
	(C) Lehavi Solutions	

*/
	
#region using	
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
#endregion


namespace BO
{	
	
	[Serializable]
	public partial class Account : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public Account()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
			DateCreated = new DateTime(1900,1,1);
			LastModified = new DateTime(1900,1,1);
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal Account(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt32(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("MasterAccountID"))
			{
				if (dr["MasterAccountID"].GetType() != typeof(DBNull))
					MasterAccountID = Convert.ToInt32(dr["MasterAccountID"]);
				else
					MasterAccountID = null;
			}

			if (dr.Table.Columns.Contains("Name"))
			{
				if (dr["Name"].GetType() != typeof(DBNull))
					Name = Convert.ToString(dr["Name"]);
				else
					Name = null;
			}

			if (dr.Table.Columns.Contains("TwUserID"))
			{
				if (dr["TwUserID"].GetType() != typeof(DBNull))
					TwUserID = Convert.ToInt64(dr["TwUserID"]);
				else
					TwUserID = null;
			}

			if (dr.Table.Columns.Contains("TwToken"))
			{
				if (dr["TwToken"].GetType() != typeof(DBNull))
					TwToken = Convert.ToString(dr["TwToken"]);
				else
					TwToken = null;
			}

			if (dr.Table.Columns.Contains("TwSecret"))
			{
				if (dr["TwSecret"].GetType() != typeof(DBNull))
					TwSecret = Convert.ToString(dr["TwSecret"]);
				else
					TwSecret = null;
			}

			if (dr.Table.Columns.Contains("TwFollowersNum"))
			{
				TwFollowersNum = Convert.ToInt32(dr["TwFollowersNum"]);
			}

			if (dr.Table.Columns.Contains("FbUid"))
			{
				if (dr["FbUid"].GetType() != typeof(DBNull))
					FbUid = Convert.ToInt64(dr["FbUid"]);
				else
					FbUid = null;
			}

			if (dr.Table.Columns.Contains("FbToken"))
			{
				if (dr["FbToken"].GetType() != typeof(DBNull))
					FbToken = Convert.ToString(dr["FbToken"]);
				else
					FbToken = null;
			}

			if (dr.Table.Columns.Contains("FbSessionKey"))
			{
				if (dr["FbSessionKey"].GetType() != typeof(DBNull))
					FbSessionKey = Convert.ToString(dr["FbSessionKey"]);
				else
					FbSessionKey = null;
			}

			if (dr.Table.Columns.Contains("FbFriendNum"))
			{
				FbFriendNum = Convert.ToInt32(dr["FbFriendNum"]);
			}

			if (dr.Table.Columns.Contains("FbPageID"))
			{
				if (dr["FbPageID"].GetType() != typeof(DBNull))
					FbPageID = Convert.ToInt64(dr["FbPageID"]);
				else
					FbPageID = null;
			}

			if (dr.Table.Columns.Contains("FbPageName"))
			{
				if (dr["FbPageName"].GetType() != typeof(DBNull))
					FbPageName = Convert.ToString(dr["FbPageName"]);
				else
					FbPageName = null;
			}

			if (dr.Table.Columns.Contains("FbPageToken"))
			{
				if (dr["FbPageToken"].GetType() != typeof(DBNull))
					FbPageToken = Convert.ToString(dr["FbPageToken"]);
				else
					FbPageToken = null;
			}

			if (dr.Table.Columns.Contains("FbPageFanNum"))
			{
				FbPageFanNum = Convert.ToInt32(dr["FbPageFanNum"]);
			}

			if (dr.Table.Columns.Contains("YtToken"))
			{
				if (dr["YtToken"].GetType() != typeof(DBNull))
					YtToken = Convert.ToString(dr["YtToken"]);
				else
					YtToken = null;
			}

			if (dr.Table.Columns.Contains("YtUsername"))
			{
				if (dr["YtUsername"].GetType() != typeof(DBNull))
					YtUsername = Convert.ToString(dr["YtUsername"]);
				else
					YtUsername = null;
			}

			if (dr.Table.Columns.Contains("YtPassword"))
			{
				if (dr["YtPassword"].GetType() != typeof(DBNull))
					YtPassword = Convert.ToString(dr["YtPassword"]);
				else
					YtPassword = null;
			}

			if (dr.Table.Columns.Contains("WpUsername"))
			{
				if (dr["WpUsername"].GetType() != typeof(DBNull))
					WpUsername = Convert.ToString(dr["WpUsername"]);
				else
					WpUsername = null;
			}

			if (dr.Table.Columns.Contains("WpPassword"))
			{
				if (dr["WpPassword"].GetType() != typeof(DBNull))
					WpPassword = Convert.ToString(dr["WpPassword"]);
				else
					WpPassword = null;
			}

			if (dr.Table.Columns.Contains("WpUrl"))
			{
				if (dr["WpUrl"].GetType() != typeof(DBNull))
					WpUrl = Convert.ToString(dr["WpUrl"]);
				else
					WpUrl = null;
			}

			if (dr.Table.Columns.Contains("FlickrToken"))
			{
				if (dr["FlickrToken"].GetType() != typeof(DBNull))
					FlickrToken = Convert.ToString(dr["FlickrToken"]);
				else
					FlickrToken = null;
			}

			if (dr.Table.Columns.Contains("DateCreated"))
			{
				DateCreated = Convert.ToDateTime(dr["DateCreated"]);
			}

			if (dr.Table.Columns.Contains("LastModified"))
			{
				LastModified = Convert.ToDateTime(dr["LastModified"]);
			}

			if (dr.Table.Columns.Contains("StatusEnum"))
			{
				if (dr["StatusEnum"].GetType() != typeof(DBNull))
					StatusEnum = Convert.ToInt32(dr["StatusEnum"]);
				else
					StatusEnum = null;
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public Account(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt32(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "MasterAccountID"))
			{
				if (dr[columnPrefix + "MasterAccountID"].GetType() != typeof(DBNull))
					MasterAccountID = Convert.ToInt32(dr[columnPrefix + "MasterAccountID"]);
				else
					MasterAccountID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Name"))
			{
				if (dr[columnPrefix + "Name"].GetType() != typeof(DBNull))
					Name = Convert.ToString(dr[columnPrefix + "Name"]);
				else
					Name = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwUserID"))
			{
				if (dr[columnPrefix + "TwUserID"].GetType() != typeof(DBNull))
					TwUserID = Convert.ToInt64(dr[columnPrefix + "TwUserID"]);
				else
					TwUserID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwToken"))
			{
				if (dr[columnPrefix + "TwToken"].GetType() != typeof(DBNull))
					TwToken = Convert.ToString(dr[columnPrefix + "TwToken"]);
				else
					TwToken = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwSecret"))
			{
				if (dr[columnPrefix + "TwSecret"].GetType() != typeof(DBNull))
					TwSecret = Convert.ToString(dr[columnPrefix + "TwSecret"]);
				else
					TwSecret = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwFollowersNum"))
			{
				TwFollowersNum = Convert.ToInt32(dr[columnPrefix + "TwFollowersNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbUid"))
			{
				if (dr[columnPrefix + "FbUid"].GetType() != typeof(DBNull))
					FbUid = Convert.ToInt64(dr[columnPrefix + "FbUid"]);
				else
					FbUid = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbToken"))
			{
				if (dr[columnPrefix + "FbToken"].GetType() != typeof(DBNull))
					FbToken = Convert.ToString(dr[columnPrefix + "FbToken"]);
				else
					FbToken = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbSessionKey"))
			{
				if (dr[columnPrefix + "FbSessionKey"].GetType() != typeof(DBNull))
					FbSessionKey = Convert.ToString(dr[columnPrefix + "FbSessionKey"]);
				else
					FbSessionKey = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbFriendNum"))
			{
				FbFriendNum = Convert.ToInt32(dr[columnPrefix + "FbFriendNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbPageID"))
			{
				if (dr[columnPrefix + "FbPageID"].GetType() != typeof(DBNull))
					FbPageID = Convert.ToInt64(dr[columnPrefix + "FbPageID"]);
				else
					FbPageID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbPageName"))
			{
				if (dr[columnPrefix + "FbPageName"].GetType() != typeof(DBNull))
					FbPageName = Convert.ToString(dr[columnPrefix + "FbPageName"]);
				else
					FbPageName = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbPageToken"))
			{
				if (dr[columnPrefix + "FbPageToken"].GetType() != typeof(DBNull))
					FbPageToken = Convert.ToString(dr[columnPrefix + "FbPageToken"]);
				else
					FbPageToken = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbPageFanNum"))
			{
				FbPageFanNum = Convert.ToInt32(dr[columnPrefix + "FbPageFanNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtToken"))
			{
				if (dr[columnPrefix + "YtToken"].GetType() != typeof(DBNull))
					YtToken = Convert.ToString(dr[columnPrefix + "YtToken"]);
				else
					YtToken = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtUsername"))
			{
				if (dr[columnPrefix + "YtUsername"].GetType() != typeof(DBNull))
					YtUsername = Convert.ToString(dr[columnPrefix + "YtUsername"]);
				else
					YtUsername = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtPassword"))
			{
				if (dr[columnPrefix + "YtPassword"].GetType() != typeof(DBNull))
					YtPassword = Convert.ToString(dr[columnPrefix + "YtPassword"]);
				else
					YtPassword = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "WpUsername"))
			{
				if (dr[columnPrefix + "WpUsername"].GetType() != typeof(DBNull))
					WpUsername = Convert.ToString(dr[columnPrefix + "WpUsername"]);
				else
					WpUsername = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "WpPassword"))
			{
				if (dr[columnPrefix + "WpPassword"].GetType() != typeof(DBNull))
					WpPassword = Convert.ToString(dr[columnPrefix + "WpPassword"]);
				else
					WpPassword = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "WpUrl"))
			{
				if (dr[columnPrefix + "WpUrl"].GetType() != typeof(DBNull))
					WpUrl = Convert.ToString(dr[columnPrefix + "WpUrl"]);
				else
					WpUrl = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FlickrToken"))
			{
				if (dr[columnPrefix + "FlickrToken"].GetType() != typeof(DBNull))
					FlickrToken = Convert.ToString(dr[columnPrefix + "FlickrToken"]);
				else
					FlickrToken = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "DateCreated"))
			{
				DateCreated = Convert.ToDateTime(dr[columnPrefix + "DateCreated"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "LastModified"))
			{
				LastModified = Convert.ToDateTime(dr[columnPrefix + "LastModified"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "StatusEnum"))
			{
				if (dr[columnPrefix + "StatusEnum"].GetType() != typeof(DBNull))
					StatusEnum = Convert.ToInt32(dr[columnPrefix + "StatusEnum"]);
				else
					StatusEnum = null;
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.Account account = BLL.Accounts.GetByID(id);
			
            ID = account.ID;
            MasterAccountID = account.MasterAccountID;
            Name = account.Name;
            TwUserID = account.TwUserID;
            TwToken = account.TwToken;
            TwSecret = account.TwSecret;
            TwFollowersNum = account.TwFollowersNum;
            FbUid = account.FbUid;
            FbToken = account.FbToken;
            FbSessionKey = account.FbSessionKey;
            FbFriendNum = account.FbFriendNum;
            FbPageID = account.FbPageID;
            FbPageName = account.FbPageName;
            FbPageToken = account.FbPageToken;
            FbPageFanNum = account.FbPageFanNum;
            YtToken = account.YtToken;
            YtUsername = account.YtUsername;
            YtPassword = account.YtPassword;
            WpUsername = account.WpUsername;
            WpPassword = account.WpPassword;
            WpUrl = account.WpUrl;
            FlickrToken = account.FlickrToken;
            DateCreated = account.DateCreated;
            LastModified = account.LastModified;
            StatusEnum = account.StatusEnum;
		}
		public int Insert()
		{
			OnPreInsert();
			return BLL.Accounts.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.Accounts.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.Accounts.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.Accounts.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.Accounts.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public int ID { get; set; }
        public int? MasterAccountID { get; set; }
        public string Name { get; set; }
        public long? TwUserID { get; set; }
        public string TwToken { get; set; }
        public string TwSecret { get; set; }
        public int TwFollowersNum { get; set; }
        public long? FbUid { get; set; }
        public string FbToken { get; set; }
        public string FbSessionKey { get; set; }
        public int FbFriendNum { get; set; }
        public long? FbPageID { get; set; }
        public string FbPageName { get; set; }
        public string FbPageToken { get; set; }
        public int FbPageFanNum { get; set; }
        public string YtToken { get; set; }
        public string YtUsername { get; set; }
        public string YtPassword { get; set; }
        public string WpUsername { get; set; }
        public string WpPassword { get; set; }
        public string WpUrl { get; set; }
        public string FlickrToken { get; set; }
        public DateTime DateCreated { get; set; }
        public DateTime LastModified { get; set; }
        public int? StatusEnum { get; set; }
		
		#endregion

		
	}
	
	
	[Serializable]
	public partial class AccountStat : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public AccountStat()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
			Date = new DateTime(1900,1,1);
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal AccountStat(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt64(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("AccountID"))
			{
				AccountID = Convert.ToInt32(dr["AccountID"]);
			}

			if (dr.Table.Columns.Contains("FbPageFanNum"))
			{
				FbPageFanNum = Convert.ToInt32(dr["FbPageFanNum"]);
			}

			if (dr.Table.Columns.Contains("FbFriendsNum"))
			{
				FbFriendsNum = Convert.ToInt32(dr["FbFriendsNum"]);
			}

			if (dr.Table.Columns.Contains("TwFollowersNum"))
			{
				TwFollowersNum = Convert.ToInt32(dr["TwFollowersNum"]);
			}

			if (dr.Table.Columns.Contains("Date"))
			{
				Date = Convert.ToDateTime(dr["Date"]);
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public AccountStat(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt64(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "AccountID"))
			{
				AccountID = Convert.ToInt32(dr[columnPrefix + "AccountID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbPageFanNum"))
			{
				FbPageFanNum = Convert.ToInt32(dr[columnPrefix + "FbPageFanNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbFriendsNum"))
			{
				FbFriendsNum = Convert.ToInt32(dr[columnPrefix + "FbFriendsNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwFollowersNum"))
			{
				TwFollowersNum = Convert.ToInt32(dr[columnPrefix + "TwFollowersNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Date"))
			{
				Date = Convert.ToDateTime(dr[columnPrefix + "Date"]);
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.AccountStat accountStat = BLL.AccountStats.GetByID(id);
			
            ID = accountStat.ID;
            AccountID = accountStat.AccountID;
            FbPageFanNum = accountStat.FbPageFanNum;
            FbFriendsNum = accountStat.FbFriendsNum;
            TwFollowersNum = accountStat.TwFollowersNum;
            Date = accountStat.Date;
		}
		public long Insert()
		{
			OnPreInsert();
			return BLL.AccountStats.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.AccountStats.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.AccountStats.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.AccountStats.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.AccountStats.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public long ID { get; set; }
        public int AccountID { get; set; }
        public int FbPageFanNum { get; set; }
        public int FbFriendsNum { get; set; }
        public int TwFollowersNum { get; set; }
        public DateTime Date { get; set; }
		
		#endregion

		
	}
	
	
	[Serializable]
	public partial class MasterAccount : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public MasterAccount()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
			DateCreated = new DateTime(1900,1,1);
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal MasterAccount(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt32(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("Name"))
			{
				if (dr["Name"].GetType() != typeof(DBNull))
					Name = Convert.ToString(dr["Name"]);
				else
					Name = null;
			}

			if (dr.Table.Columns.Contains("ProfileID"))
			{
				ProfileID = Convert.ToInt32(dr["ProfileID"]);
			}

			if (dr.Table.Columns.Contains("DateCreated"))
			{
				DateCreated = Convert.ToDateTime(dr["DateCreated"]);
			}

			if (dr.Table.Columns.Contains("StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr["StatusEnum"]);
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public MasterAccount(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt32(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Name"))
			{
				if (dr[columnPrefix + "Name"].GetType() != typeof(DBNull))
					Name = Convert.ToString(dr[columnPrefix + "Name"]);
				else
					Name = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "ProfileID"))
			{
				ProfileID = Convert.ToInt32(dr[columnPrefix + "ProfileID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "DateCreated"))
			{
				DateCreated = Convert.ToDateTime(dr[columnPrefix + "DateCreated"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr[columnPrefix + "StatusEnum"]);
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.MasterAccount masterAccount = BLL.MasterAccounts.GetByID(id);
			
            ID = masterAccount.ID;
            Name = masterAccount.Name;
            ProfileID = masterAccount.ProfileID;
            DateCreated = masterAccount.DateCreated;
            StatusEnum = masterAccount.StatusEnum;
		}
		public int Insert()
		{
			OnPreInsert();
			return BLL.MasterAccounts.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.MasterAccounts.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.MasterAccounts.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.MasterAccounts.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.MasterAccounts.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public int ID { get; set; }
        public string Name { get; set; }
        public int ProfileID { get; set; }
        public DateTime DateCreated { get; set; }
        public int StatusEnum { get; set; }
		
		#endregion

		
	}
	
	
	[Serializable]
	public partial class Post : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public Post()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
			TimePosted = new DateTime(1900,1,1);
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal Post(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt64(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("EnumPostType"))
			{
				EnumPostType = Convert.ToInt32(dr["EnumPostType"]);
			}

			if (dr.Table.Columns.Contains("AccountID"))
			{
				AccountID = Convert.ToInt32(dr["AccountID"]);
			}

			if (dr.Table.Columns.Contains("PostingUserID"))
			{
				if (dr["PostingUserID"].GetType() != typeof(DBNull))
					PostingUserID = Convert.ToInt32(dr["PostingUserID"]);
				else
					PostingUserID = null;
			}

			if (dr.Table.Columns.Contains("TimePosted"))
			{
				TimePosted = Convert.ToDateTime(dr["TimePosted"]);
			}

			if (dr.Table.Columns.Contains("Title"))
			{
				if (dr["Title"].GetType() != typeof(DBNull))
					Title = Convert.ToString(dr["Title"]);
				else
					Title = null;
			}

			if (dr.Table.Columns.Contains("Text"))
			{
				if (dr["Text"].GetType() != typeof(DBNull))
					Text = Convert.ToString(dr["Text"]);
				else
					Text = null;
			}

			if (dr.Table.Columns.Contains("TwStatusId"))
			{
				if (dr["TwStatusId"].GetType() != typeof(DBNull))
					TwStatusId = Convert.ToString(dr["TwStatusId"]);
				else
					TwStatusId = null;
			}

			if (dr.Table.Columns.Contains("TwReplyNum"))
			{
				TwReplyNum = Convert.ToInt32(dr["TwReplyNum"]);
			}

			if (dr.Table.Columns.Contains("TwRetweetNum"))
			{
				TwRetweetNum = Convert.ToInt32(dr["TwRetweetNum"]);
			}

			if (dr.Table.Columns.Contains("FbItemID"))
			{
				if (dr["FbItemID"].GetType() != typeof(DBNull))
					FbItemID = Convert.ToString(dr["FbItemID"]);
				else
					FbItemID = null;
			}

			if (dr.Table.Columns.Contains("FbCommentNum"))
			{
				FbCommentNum = Convert.ToInt32(dr["FbCommentNum"]);
			}

			if (dr.Table.Columns.Contains("FbShareNum"))
			{
				FbShareNum = Convert.ToInt32(dr["FbShareNum"]);
			}

			if (dr.Table.Columns.Contains("FbLikeNum"))
			{
				FbLikeNum = Convert.ToInt32(dr["FbLikeNum"]);
			}

			if (dr.Table.Columns.Contains("YtVideoId"))
			{
				if (dr["YtVideoId"].GetType() != typeof(DBNull))
					YtVideoId = Convert.ToString(dr["YtVideoId"]);
				else
					YtVideoId = null;
			}

			if (dr.Table.Columns.Contains("YtViewsNum"))
			{
				YtViewsNum = Convert.ToInt32(dr["YtViewsNum"]);
			}

			if (dr.Table.Columns.Contains("YtCommentnum"))
			{
				YtCommentnum = Convert.ToInt32(dr["YtCommentnum"]);
			}

			if (dr.Table.Columns.Contains("YtRating"))
			{
				YtRating = Convert.ToDouble(dr["YtRating"]);
			}

			if (dr.Table.Columns.Contains("WpPostID"))
			{
				if (dr["WpPostID"].GetType() != typeof(DBNull))
					WpPostID = Convert.ToString(dr["WpPostID"]);
				else
					WpPostID = null;
			}

			if (dr.Table.Columns.Contains("WpCommentNum"))
			{
				WpCommentNum = Convert.ToInt32(dr["WpCommentNum"]);
			}

			if (dr.Table.Columns.Contains("FlickrID"))
			{
				if (dr["FlickrID"].GetType() != typeof(DBNull))
					FlickrID = Convert.ToString(dr["FlickrID"]);
				else
					FlickrID = null;
			}

			if (dr.Table.Columns.Contains("FlickrUrl"))
			{
				if (dr["FlickrUrl"].GetType() != typeof(DBNull))
					FlickrUrl = Convert.ToString(dr["FlickrUrl"]);
				else
					FlickrUrl = null;
			}

			if (dr.Table.Columns.Contains("FlickrCommentNum"))
			{
				FlickrCommentNum = Convert.ToInt32(dr["FlickrCommentNum"]);
			}

			if (dr.Table.Columns.Contains("StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr["StatusEnum"]);
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public Post(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt64(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "EnumPostType"))
			{
				EnumPostType = Convert.ToInt32(dr[columnPrefix + "EnumPostType"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "AccountID"))
			{
				AccountID = Convert.ToInt32(dr[columnPrefix + "AccountID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "PostingUserID"))
			{
				if (dr[columnPrefix + "PostingUserID"].GetType() != typeof(DBNull))
					PostingUserID = Convert.ToInt32(dr[columnPrefix + "PostingUserID"]);
				else
					PostingUserID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TimePosted"))
			{
				TimePosted = Convert.ToDateTime(dr[columnPrefix + "TimePosted"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Title"))
			{
				if (dr[columnPrefix + "Title"].GetType() != typeof(DBNull))
					Title = Convert.ToString(dr[columnPrefix + "Title"]);
				else
					Title = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Text"))
			{
				if (dr[columnPrefix + "Text"].GetType() != typeof(DBNull))
					Text = Convert.ToString(dr[columnPrefix + "Text"]);
				else
					Text = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwStatusId"))
			{
				if (dr[columnPrefix + "TwStatusId"].GetType() != typeof(DBNull))
					TwStatusId = Convert.ToString(dr[columnPrefix + "TwStatusId"]);
				else
					TwStatusId = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwReplyNum"))
			{
				TwReplyNum = Convert.ToInt32(dr[columnPrefix + "TwReplyNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwRetweetNum"))
			{
				TwRetweetNum = Convert.ToInt32(dr[columnPrefix + "TwRetweetNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbItemID"))
			{
				if (dr[columnPrefix + "FbItemID"].GetType() != typeof(DBNull))
					FbItemID = Convert.ToString(dr[columnPrefix + "FbItemID"]);
				else
					FbItemID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbCommentNum"))
			{
				FbCommentNum = Convert.ToInt32(dr[columnPrefix + "FbCommentNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbShareNum"))
			{
				FbShareNum = Convert.ToInt32(dr[columnPrefix + "FbShareNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbLikeNum"))
			{
				FbLikeNum = Convert.ToInt32(dr[columnPrefix + "FbLikeNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtVideoId"))
			{
				if (dr[columnPrefix + "YtVideoId"].GetType() != typeof(DBNull))
					YtVideoId = Convert.ToString(dr[columnPrefix + "YtVideoId"]);
				else
					YtVideoId = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtViewsNum"))
			{
				YtViewsNum = Convert.ToInt32(dr[columnPrefix + "YtViewsNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtCommentnum"))
			{
				YtCommentnum = Convert.ToInt32(dr[columnPrefix + "YtCommentnum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtRating"))
			{
				YtRating = Convert.ToDouble(dr[columnPrefix + "YtRating"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "WpPostID"))
			{
				if (dr[columnPrefix + "WpPostID"].GetType() != typeof(DBNull))
					WpPostID = Convert.ToString(dr[columnPrefix + "WpPostID"]);
				else
					WpPostID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "WpCommentNum"))
			{
				WpCommentNum = Convert.ToInt32(dr[columnPrefix + "WpCommentNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FlickrID"))
			{
				if (dr[columnPrefix + "FlickrID"].GetType() != typeof(DBNull))
					FlickrID = Convert.ToString(dr[columnPrefix + "FlickrID"]);
				else
					FlickrID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FlickrUrl"))
			{
				if (dr[columnPrefix + "FlickrUrl"].GetType() != typeof(DBNull))
					FlickrUrl = Convert.ToString(dr[columnPrefix + "FlickrUrl"]);
				else
					FlickrUrl = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FlickrCommentNum"))
			{
				FlickrCommentNum = Convert.ToInt32(dr[columnPrefix + "FlickrCommentNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr[columnPrefix + "StatusEnum"]);
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.Post post = BLL.Posts.GetByID(id);
			
            ID = post.ID;
            EnumPostType = post.EnumPostType;
            AccountID = post.AccountID;
            PostingUserID = post.PostingUserID;
            TimePosted = post.TimePosted;
            Title = post.Title;
            Text = post.Text;
            TwStatusId = post.TwStatusId;
            TwReplyNum = post.TwReplyNum;
            TwRetweetNum = post.TwRetweetNum;
            FbItemID = post.FbItemID;
            FbCommentNum = post.FbCommentNum;
            FbShareNum = post.FbShareNum;
            FbLikeNum = post.FbLikeNum;
            YtVideoId = post.YtVideoId;
            YtViewsNum = post.YtViewsNum;
            YtCommentnum = post.YtCommentnum;
            YtRating = post.YtRating;
            WpPostID = post.WpPostID;
            WpCommentNum = post.WpCommentNum;
            FlickrID = post.FlickrID;
            FlickrUrl = post.FlickrUrl;
            FlickrCommentNum = post.FlickrCommentNum;
            StatusEnum = post.StatusEnum;
		}
		public long Insert()
		{
			OnPreInsert();
			return BLL.Posts.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.Posts.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.Posts.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.Posts.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.Posts.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public long ID { get; set; }
        public int EnumPostType { get; set; }
        public int AccountID { get; set; }
        public int? PostingUserID { get; set; }
        public DateTime TimePosted { get; set; }
        public string Title { get; set; }
        public string Text { get; set; }
        public string TwStatusId { get; set; }
        public int TwReplyNum { get; set; }
        public int TwRetweetNum { get; set; }
        public string FbItemID { get; set; }
        public int FbCommentNum { get; set; }
        public int FbShareNum { get; set; }
        public int FbLikeNum { get; set; }
        public string YtVideoId { get; set; }
        public int YtViewsNum { get; set; }
        public int YtCommentnum { get; set; }
        public double YtRating { get; set; }
        public string WpPostID { get; set; }
        public int WpCommentNum { get; set; }
        public string FlickrID { get; set; }
        public string FlickrUrl { get; set; }
        public int FlickrCommentNum { get; set; }
        public int StatusEnum { get; set; }
		
		#endregion

		
	}
	
	
	[Serializable]
	public partial class PostStat : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public PostStat()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
			Date = new DateTime(1900,1,1);
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal PostStat(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt64(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("PostID"))
			{
				PostID = Convert.ToInt64(dr["PostID"]);
			}

			if (dr.Table.Columns.Contains("Date"))
			{
				Date = Convert.ToDateTime(dr["Date"]);
			}

			if (dr.Table.Columns.Contains("TwReplyNum"))
			{
				TwReplyNum = Convert.ToInt32(dr["TwReplyNum"]);
			}

			if (dr.Table.Columns.Contains("TwRetweetNum"))
			{
				TwRetweetNum = Convert.ToInt32(dr["TwRetweetNum"]);
			}

			if (dr.Table.Columns.Contains("FbCommentNum"))
			{
				FbCommentNum = Convert.ToInt32(dr["FbCommentNum"]);
			}

			if (dr.Table.Columns.Contains("FbShareNum"))
			{
				FbShareNum = Convert.ToInt32(dr["FbShareNum"]);
			}

			if (dr.Table.Columns.Contains("FbLikeNum"))
			{
				FbLikeNum = Convert.ToInt32(dr["FbLikeNum"]);
			}

			if (dr.Table.Columns.Contains("YtViewsNum"))
			{
				YtViewsNum = Convert.ToInt32(dr["YtViewsNum"]);
			}

			if (dr.Table.Columns.Contains("YtCommentnum"))
			{
				YtCommentnum = Convert.ToInt32(dr["YtCommentnum"]);
			}

			if (dr.Table.Columns.Contains("YtRating"))
			{
				YtRating = Convert.ToDouble(dr["YtRating"]);
			}

			if (dr.Table.Columns.Contains("WpCommentNum"))
			{
				WpCommentNum = Convert.ToInt32(dr["WpCommentNum"]);
			}

			if (dr.Table.Columns.Contains("FlickrCommentNum"))
			{
				FlickrCommentNum = Convert.ToInt32(dr["FlickrCommentNum"]);
			}

			if (dr.Table.Columns.Contains("StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr["StatusEnum"]);
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public PostStat(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt64(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "PostID"))
			{
				PostID = Convert.ToInt64(dr[columnPrefix + "PostID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Date"))
			{
				Date = Convert.ToDateTime(dr[columnPrefix + "Date"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwReplyNum"))
			{
				TwReplyNum = Convert.ToInt32(dr[columnPrefix + "TwReplyNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TwRetweetNum"))
			{
				TwRetweetNum = Convert.ToInt32(dr[columnPrefix + "TwRetweetNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbCommentNum"))
			{
				FbCommentNum = Convert.ToInt32(dr[columnPrefix + "FbCommentNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbShareNum"))
			{
				FbShareNum = Convert.ToInt32(dr[columnPrefix + "FbShareNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbLikeNum"))
			{
				FbLikeNum = Convert.ToInt32(dr[columnPrefix + "FbLikeNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtViewsNum"))
			{
				YtViewsNum = Convert.ToInt32(dr[columnPrefix + "YtViewsNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtCommentnum"))
			{
				YtCommentnum = Convert.ToInt32(dr[columnPrefix + "YtCommentnum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "YtRating"))
			{
				YtRating = Convert.ToDouble(dr[columnPrefix + "YtRating"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "WpCommentNum"))
			{
				WpCommentNum = Convert.ToInt32(dr[columnPrefix + "WpCommentNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FlickrCommentNum"))
			{
				FlickrCommentNum = Convert.ToInt32(dr[columnPrefix + "FlickrCommentNum"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr[columnPrefix + "StatusEnum"]);
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.PostStat postStat = BLL.PostStats.GetByID(id);
			
            ID = postStat.ID;
            PostID = postStat.PostID;
            Date = postStat.Date;
            TwReplyNum = postStat.TwReplyNum;
            TwRetweetNum = postStat.TwRetweetNum;
            FbCommentNum = postStat.FbCommentNum;
            FbShareNum = postStat.FbShareNum;
            FbLikeNum = postStat.FbLikeNum;
            YtViewsNum = postStat.YtViewsNum;
            YtCommentnum = postStat.YtCommentnum;
            YtRating = postStat.YtRating;
            WpCommentNum = postStat.WpCommentNum;
            FlickrCommentNum = postStat.FlickrCommentNum;
            StatusEnum = postStat.StatusEnum;
		}
		public long Insert()
		{
			OnPreInsert();
			return BLL.PostStats.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.PostStats.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.PostStats.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.PostStats.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.PostStats.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public long ID { get; set; }
        public long PostID { get; set; }
        public DateTime Date { get; set; }
        public int TwReplyNum { get; set; }
        public int TwRetweetNum { get; set; }
        public int FbCommentNum { get; set; }
        public int FbShareNum { get; set; }
        public int FbLikeNum { get; set; }
        public int YtViewsNum { get; set; }
        public int YtCommentnum { get; set; }
        public double YtRating { get; set; }
        public int WpCommentNum { get; set; }
        public int FlickrCommentNum { get; set; }
        public int StatusEnum { get; set; }
		
		#endregion

		
	}
	
	
	[Serializable]
	public partial class Profile : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public Profile()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal Profile(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt32(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("Name"))
			{
				if (dr["Name"].GetType() != typeof(DBNull))
					Name = Convert.ToString(dr["Name"]);
				else
					Name = null;
			}

			if (dr.Table.Columns.Contains("DateCreated"))
			{
				if (dr["DateCreated"].GetType() != typeof(DBNull))
					DateCreated = Convert.ToDateTime(dr["DateCreated"]);
				else
					DateCreated = null;
			}

			if (dr.Table.Columns.Contains("StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr["StatusEnum"]);
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public Profile(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt32(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Name"))
			{
				if (dr[columnPrefix + "Name"].GetType() != typeof(DBNull))
					Name = Convert.ToString(dr[columnPrefix + "Name"]);
				else
					Name = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "DateCreated"))
			{
				if (dr[columnPrefix + "DateCreated"].GetType() != typeof(DBNull))
					DateCreated = Convert.ToDateTime(dr[columnPrefix + "DateCreated"]);
				else
					DateCreated = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr[columnPrefix + "StatusEnum"]);
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.Profile profile = BLL.Profiles.GetByID(id);
			
            ID = profile.ID;
            Name = profile.Name;
            DateCreated = profile.DateCreated;
            StatusEnum = profile.StatusEnum;
		}
		public int Insert()
		{
			OnPreInsert();
			return BLL.Profiles.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.Profiles.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.Profiles.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.Profiles.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.Profiles.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public int ID { get; set; }
        public string Name { get; set; }
        public DateTime? DateCreated { get; set; }
        public int StatusEnum { get; set; }
		
		#endregion

		
	}
	
	
	[Serializable]
	public partial class TracedAccount : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public TracedAccount()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
			StartDate = new DateTime(1900,1,1);
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal TracedAccount(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt32(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("AccountID"))
			{
				AccountID = Convert.ToInt32(dr["AccountID"]);
			}

			if (dr.Table.Columns.Contains("EnumType"))
			{
				EnumType = Convert.ToInt32(dr["EnumType"]);
			}

			if (dr.Table.Columns.Contains("Name"))
			{
				if (dr["Name"].GetType() != typeof(DBNull))
					Name = Convert.ToString(dr["Name"]);
				else
					Name = null;
			}

			if (dr.Table.Columns.Contains("ImageUrl"))
			{
				if (dr["ImageUrl"].GetType() != typeof(DBNull))
					ImageUrl = Convert.ToString(dr["ImageUrl"]);
				else
					ImageUrl = null;
			}

			if (dr.Table.Columns.Contains("FbPageID"))
			{
				if (dr["FbPageID"].GetType() != typeof(DBNull))
					FbPageID = Convert.ToInt64(dr["FbPageID"]);
				else
					FbPageID = null;
			}

			if (dr.Table.Columns.Contains("FbPageUrl"))
			{
				if (dr["FbPageUrl"].GetType() != typeof(DBNull))
					FbPageUrl = Convert.ToString(dr["FbPageUrl"]);
				else
					FbPageUrl = null;
			}

			if (dr.Table.Columns.Contains("FanNum"))
			{
				if (dr["FanNum"].GetType() != typeof(DBNull))
					FanNum = Convert.ToInt32(dr["FanNum"]);
				else
					FanNum = null;
			}

			if (dr.Table.Columns.Contains("StartDate"))
			{
				StartDate = Convert.ToDateTime(dr["StartDate"]);
			}

			if (dr.Table.Columns.Contains("StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr["StatusEnum"]);
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public TracedAccount(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt32(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "AccountID"))
			{
				AccountID = Convert.ToInt32(dr[columnPrefix + "AccountID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "EnumType"))
			{
				EnumType = Convert.ToInt32(dr[columnPrefix + "EnumType"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Name"))
			{
				if (dr[columnPrefix + "Name"].GetType() != typeof(DBNull))
					Name = Convert.ToString(dr[columnPrefix + "Name"]);
				else
					Name = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "ImageUrl"))
			{
				if (dr[columnPrefix + "ImageUrl"].GetType() != typeof(DBNull))
					ImageUrl = Convert.ToString(dr[columnPrefix + "ImageUrl"]);
				else
					ImageUrl = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbPageID"))
			{
				if (dr[columnPrefix + "FbPageID"].GetType() != typeof(DBNull))
					FbPageID = Convert.ToInt64(dr[columnPrefix + "FbPageID"]);
				else
					FbPageID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FbPageUrl"))
			{
				if (dr[columnPrefix + "FbPageUrl"].GetType() != typeof(DBNull))
					FbPageUrl = Convert.ToString(dr[columnPrefix + "FbPageUrl"]);
				else
					FbPageUrl = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FanNum"))
			{
				if (dr[columnPrefix + "FanNum"].GetType() != typeof(DBNull))
					FanNum = Convert.ToInt32(dr[columnPrefix + "FanNum"]);
				else
					FanNum = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "StartDate"))
			{
				StartDate = Convert.ToDateTime(dr[columnPrefix + "StartDate"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr[columnPrefix + "StatusEnum"]);
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.TracedAccount tracedAccount = BLL.TracedAccounts.GetByID(id);
			
            ID = tracedAccount.ID;
            AccountID = tracedAccount.AccountID;
            EnumType = tracedAccount.EnumType;
            Name = tracedAccount.Name;
            ImageUrl = tracedAccount.ImageUrl;
            FbPageID = tracedAccount.FbPageID;
            FbPageUrl = tracedAccount.FbPageUrl;
            FanNum = tracedAccount.FanNum;
            StartDate = tracedAccount.StartDate;
            StatusEnum = tracedAccount.StatusEnum;
		}
		public int Insert()
		{
			OnPreInsert();
			return BLL.TracedAccounts.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.TracedAccounts.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.TracedAccounts.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.TracedAccounts.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.TracedAccounts.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public int ID { get; set; }
        public int AccountID { get; set; }
        public int EnumType { get; set; }
        public string Name { get; set; }
        public string ImageUrl { get; set; }
        public long? FbPageID { get; set; }
        public string FbPageUrl { get; set; }
        public int? FanNum { get; set; }
        public DateTime StartDate { get; set; }
        public int StatusEnum { get; set; }
		
		#endregion

		
	}
	
	
	[Serializable]
	public partial class TraceStat : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public TraceStat()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
			Date = new DateTime(1900,1,1);
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal TraceStat(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt64(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("TraceAccountID"))
			{
				if (dr["TraceAccountID"].GetType() != typeof(DBNull))
					TraceAccountID = Convert.ToInt32(dr["TraceAccountID"]);
				else
					TraceAccountID = null;
			}

			if (dr.Table.Columns.Contains("Date"))
			{
				Date = Convert.ToDateTime(dr["Date"]);
			}

			if (dr.Table.Columns.Contains("FanNum"))
			{
				FanNum = Convert.ToInt32(dr["FanNum"]);
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public TraceStat(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt64(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "TraceAccountID"))
			{
				if (dr[columnPrefix + "TraceAccountID"].GetType() != typeof(DBNull))
					TraceAccountID = Convert.ToInt32(dr[columnPrefix + "TraceAccountID"]);
				else
					TraceAccountID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Date"))
			{
				Date = Convert.ToDateTime(dr[columnPrefix + "Date"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FanNum"))
			{
				FanNum = Convert.ToInt32(dr[columnPrefix + "FanNum"]);
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.TraceStat traceStat = BLL.TraceStats.GetByID(id);
			
            ID = traceStat.ID;
            TraceAccountID = traceStat.TraceAccountID;
            Date = traceStat.Date;
            FanNum = traceStat.FanNum;
		}
		public long Insert()
		{
			OnPreInsert();
			return BLL.TraceStats.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.TraceStats.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.TraceStats.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.TraceStats.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.TraceStats.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public long ID { get; set; }
        public int? TraceAccountID { get; set; }
        public DateTime Date { get; set; }
        public int FanNum { get; set; }
		
		#endregion

		
	}
	
	
	[Serializable]
	public partial class UnProcessedPost : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public UnProcessedPost()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal UnProcessedPost(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt64(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("PostID"))
			{
				PostID = Convert.ToInt64(dr["PostID"]);
			}

			if (dr.Table.Columns.Contains("EnumStage"))
			{
				EnumStage = Convert.ToInt32(dr["EnumStage"]);
			}

			if (dr.Table.Columns.Contains("PostOnFb"))
			{
				if (dr["PostOnFb"].GetType() != typeof(DBNull))
					PostOnFb = Convert.ToBoolean(dr["PostOnFb"]);
				else
					PostOnFb = null;
			}

			if (dr.Table.Columns.Contains("PostOnTw"))
			{
				if (dr["PostOnTw"].GetType() != typeof(DBNull))
					PostOnTw = Convert.ToBoolean(dr["PostOnTw"]);
				else
					PostOnTw = null;
			}

			if (dr.Table.Columns.Contains("PostOnWp"))
			{
				if (dr["PostOnWp"].GetType() != typeof(DBNull))
					PostOnWp = Convert.ToBoolean(dr["PostOnWp"]);
				else
					PostOnWp = null;
			}

			if (dr.Table.Columns.Contains("Comment"))
			{
				if (dr["Comment"].GetType() != typeof(DBNull))
					Comment = Convert.ToString(dr["Comment"]);
				else
					Comment = null;
			}

			if (dr.Table.Columns.Contains("StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr["StatusEnum"]);
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public UnProcessedPost(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt64(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "PostID"))
			{
				PostID = Convert.ToInt64(dr[columnPrefix + "PostID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "EnumStage"))
			{
				EnumStage = Convert.ToInt32(dr[columnPrefix + "EnumStage"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "PostOnFb"))
			{
				if (dr[columnPrefix + "PostOnFb"].GetType() != typeof(DBNull))
					PostOnFb = Convert.ToBoolean(dr[columnPrefix + "PostOnFb"]);
				else
					PostOnFb = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "PostOnTw"))
			{
				if (dr[columnPrefix + "PostOnTw"].GetType() != typeof(DBNull))
					PostOnTw = Convert.ToBoolean(dr[columnPrefix + "PostOnTw"]);
				else
					PostOnTw = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "PostOnWp"))
			{
				if (dr[columnPrefix + "PostOnWp"].GetType() != typeof(DBNull))
					PostOnWp = Convert.ToBoolean(dr[columnPrefix + "PostOnWp"]);
				else
					PostOnWp = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Comment"))
			{
				if (dr[columnPrefix + "Comment"].GetType() != typeof(DBNull))
					Comment = Convert.ToString(dr[columnPrefix + "Comment"]);
				else
					Comment = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr[columnPrefix + "StatusEnum"]);
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.UnProcessedPost unProcessedPost = BLL.UnProcessedPosts.GetByID(id);
			
            ID = unProcessedPost.ID;
            PostID = unProcessedPost.PostID;
            EnumStage = unProcessedPost.EnumStage;
            PostOnFb = unProcessedPost.PostOnFb;
            PostOnTw = unProcessedPost.PostOnTw;
            PostOnWp = unProcessedPost.PostOnWp;
            Comment = unProcessedPost.Comment;
            StatusEnum = unProcessedPost.StatusEnum;
		}
		public long Insert()
		{
			OnPreInsert();
			return BLL.UnProcessedPosts.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.UnProcessedPosts.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.UnProcessedPosts.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.UnProcessedPosts.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.UnProcessedPosts.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public long ID { get; set; }
        public long PostID { get; set; }
        public int EnumStage { get; set; }
        public bool? PostOnFb { get; set; }
        public bool? PostOnTw { get; set; }
        public bool? PostOnWp { get; set; }
        public string Comment { get; set; }
        public int StatusEnum { get; set; }
		
		#endregion

		
	}
	
	
	[Serializable]
	public partial class User : BLL.EntityBase
	{
		#region Constructors
		/// Empty Constructor
		public User()
		{
			InitializeDateProperties();
		}
		
		// Initialize all the none nullable datetime vars to 1.1.1900 (to avoid SQL crash on insert)
		private void InitializeDateProperties()
		{
			LastModified = new DateTime(1900,1,1);
		}
		
		/// <summary>
		/// DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		internal User(DataRow dr)
		{
			InitializeDateProperties();
			if (dr.Table.Columns.Contains("ID"))
			{
				ID = Convert.ToInt32(dr["ID"]);
			}

			if (dr.Table.Columns.Contains("Email"))
			{
				if (dr["Email"].GetType() != typeof(DBNull))
					Email = Convert.ToString(dr["Email"]);
				else
					Email = null;
			}

			if (dr.Table.Columns.Contains("Username"))
			{
				if (dr["Username"].GetType() != typeof(DBNull))
					Username = Convert.ToString(dr["Username"]);
				else
					Username = null;
			}

			if (dr.Table.Columns.Contains("Password"))
			{
				if (dr["Password"].GetType() != typeof(DBNull))
					Password = Convert.ToString(dr["Password"]);
				else
					Password = null;
			}

			if (dr.Table.Columns.Contains("FirstName"))
			{
				if (dr["FirstName"].GetType() != typeof(DBNull))
					FirstName = Convert.ToString(dr["FirstName"]);
				else
					FirstName = null;
			}

			if (dr.Table.Columns.Contains("LastName"))
			{
				if (dr["LastName"].GetType() != typeof(DBNull))
					LastName = Convert.ToString(dr["LastName"]);
				else
					LastName = null;
			}

			if (dr.Table.Columns.Contains("ProfileID"))
			{
				if (dr["ProfileID"].GetType() != typeof(DBNull))
					ProfileID = Convert.ToInt32(dr["ProfileID"]);
				else
					ProfileID = null;
			}

			if (dr.Table.Columns.Contains("LastModified"))
			{
				LastModified = Convert.ToDateTime(dr["LastModified"]);
			}

			if (dr.Table.Columns.Contains("StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr["StatusEnum"]);
			}

		}		
		
		/// <summary>
		/// Explicit Table DataRow Constructor
		/// </summary>
		/// <param name="dr"></param>
		/// <param name="columnPrefix"></param>
		public User(DataRow dr, string columnPrefix)
		{
			if (dr.Table.Columns.Contains(columnPrefix + "ID"))
			{
				ID = Convert.ToInt32(dr[columnPrefix + "ID"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Email"))
			{
				if (dr[columnPrefix + "Email"].GetType() != typeof(DBNull))
					Email = Convert.ToString(dr[columnPrefix + "Email"]);
				else
					Email = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Username"))
			{
				if (dr[columnPrefix + "Username"].GetType() != typeof(DBNull))
					Username = Convert.ToString(dr[columnPrefix + "Username"]);
				else
					Username = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "Password"))
			{
				if (dr[columnPrefix + "Password"].GetType() != typeof(DBNull))
					Password = Convert.ToString(dr[columnPrefix + "Password"]);
				else
					Password = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "FirstName"))
			{
				if (dr[columnPrefix + "FirstName"].GetType() != typeof(DBNull))
					FirstName = Convert.ToString(dr[columnPrefix + "FirstName"]);
				else
					FirstName = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "LastName"))
			{
				if (dr[columnPrefix + "LastName"].GetType() != typeof(DBNull))
					LastName = Convert.ToString(dr[columnPrefix + "LastName"]);
				else
					LastName = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "ProfileID"))
			{
				if (dr[columnPrefix + "ProfileID"].GetType() != typeof(DBNull))
					ProfileID = Convert.ToInt32(dr[columnPrefix + "ProfileID"]);
				else
					ProfileID = null;
			}

			if (dr.Table.Columns.Contains(columnPrefix + "LastModified"))
			{
				LastModified = Convert.ToDateTime(dr[columnPrefix + "LastModified"]);
			}

			if (dr.Table.Columns.Contains(columnPrefix + "StatusEnum"))
			{
				StatusEnum = Convert.ToInt32(dr[columnPrefix + "StatusEnum"]);
			}

		}
		#endregion
		
		
		#region CRUD Methods
		
		public void GetByID(object id)
		{
			BO.User user = BLL.Users.GetByID(id);
			
            ID = user.ID;
            Email = user.Email;
            Username = user.Username;
            Password = user.Password;
            FirstName = user.FirstName;
            LastName = user.LastName;
            ProfileID = user.ProfileID;
            LastModified = user.LastModified;
            StatusEnum = user.StatusEnum;
		}
		public int Insert()
		{
			OnPreInsert();
			return BLL.Users.Insert(this);
		}
		
		public override void Update()
		{
			OnPreUpdate();
			BLL.Users.Update(this);
		}
		
		public override void Delete()
		{
			OnPreDelete();
			BLL.Users.Delete(ID);
		}
		
		public override void SafeDelete()
		{
			OnPreDelete();
			BLL.Users.SafeDelete(ID);
		}
		
		public override void SafeDeleteCascade()
		{
			OnPreDelete();
			BLL.Users.SafeDeleteCascade(ID);
		}

		#endregion

		#region Properties
		
        public int ID { get; set; }
        public string Email { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public int? ProfileID { get; set; }
        public DateTime LastModified { get; set; }
        public int StatusEnum { get; set; }
		
		#endregion

		
	}
	
}



